/*mbox.js*/

/* checkbox 배경이미지 */

function chk_selected(f){	
	var _tr = f;
	while(_tr.tagName.toLowerCase() != "tr"){
		_tr = _tr.parentNode;
	}
	
	if(f.checked){
		_tr.className += " checked";
	}else{
		_tr.className = _tr.className.replace("checked","");
	}
	return false;
	
	var clintAgent = navigator.userAgent;
	if ( clintAgent.indexOf("MSIE") != -1 ){
		if (f.checked){
			f.parentNode.parentNode.className='listSelected';
			f.parentNode.parentNode.firstChild.style.backgroundColor = "#ffffff";
			f.parentNode.parentNode.lastChild.style.backgroundColor = "#ffffff";
		}else {
			f.parentNode.parentNode.className='listBlur';
		}
	}
}



/* input box line */

function inFocus1(i) {
	(i).style.border='1px solid #e6383a';
}
function outFocus1(i) {
	(i).style.border='1px solid #D9D9D9';
}


/* ie6 pnb투명 */
					
function setPng24(obj) { 
	var request_os = window.navigator.userAgent; 
	var os_array = request_os.split(";"); 
	if(os_array[1] != " MSIE 7.0") { 
		obj.width=obj.height=1; 
		obj.className=obj.className.replace(/png24/i,''); 
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"; 
		obj.src=''; 
	} 
								
	return ''; 
} 

/* 메일 레이어 숨김과 보여여주 */

var curBgColor = "";
var selectDivs = ["",  "etcToolDiv1", "etcToolDiv2"];
var toolDivs = ["",  "etcTool1", "etcTool2"];
 
function meritzMacro(evt){
	var objEvent = null
	try{
		objEvent = event;
	}catch(e){
		objEvent = evt;
	}
	if(!(objEvent)) return;
	
	var code = IsIE() ? objEvent.keyCode : objEvent.which;
	
	//ctrl +
	if(objEvent.ctrlKey){		
	}
	//alt +
	if(objEvent.altKey){
		switch(code){
			case 33: //pgUp
				try{
					location.href = document.getElementById("goPageUp").href;
				}catch(e){}
									
				break;
					
			case 34: //pgDn
				try{
					location.href = document.getElementById("goPageDown").href;
				}catch(e){}
					
				break;
		}
	}	
	//shift +

 
	switch(code){			
		case 36:
			try{
				location.href = document.getElementById("goRecent").href;
			}catch(e){}
				
			break;	
	}
}
 
document.onmouseup = clearTools;


function toggleBoxClick(obj){
	var element = document.getElementById(obj);

	if(element.style.display == "none" || element.className == "hide"){
		element.style.display = "inline";
	}else if(element.style.display == "block" || element.style.display == "inline" || element.style.display == "" || element.className == "show"){
		element.style.display = "none";
	}else{
		element.style.display = "none";
	}
}




/****** layer  ****/
function setDisplay(objName,status) {
	var obj = document.all[objName];
	if (obj) {
		if (status == 'on') obj.style.display = "";
		if (status == 'off') obj.style.display = "none";
	}
}



//레이어 메뉴를 띄우고 다른곳이나 다른 레이어를 클릭했을 경우 닫히도록 하는 함수
function clearTools(e){	
	if(!toolDivs || !selectDivs) return false;
	if(!e) var e = window.event;	
	
	var clickedObj = e.srcElement || e.target;

	if(clickedObj.tagName == "IMG" || clickedObj.tagName == "img"){
		clickedObj = clickedObj.parentNode;
	}

	var clickedID = clickedObj.id;
	var okIndex = 0;


	for(var i=1; i<selectDivs.length; i++){
		if(clickedID == selectDivs[i]) okIndex = i;
	}

	if(okIndex != 0){
		for(var j=1; j<toolDivs.length; j++){
			if(j != okIndex){			
				var okItem = document.getElementById(toolDivs[j]);
				if(okItem) okItem.style.display = "none";
			}
		}
	}else{
		for(var j=1; j<toolDivs.length; j++){
			var okItem = document.getElementById(toolDivs[j])
			if(okItem) okItem.style.display = "none";
		}
	}
}


//버튼 이미지 오버
var detailsearch={
	toggleLayer:function(){
		$('#id_div_detailsearch').toggle();
	}
	,period:function(period){
		var $i = $('#id_speriod');
		var pre = $i.val();
 
		$('#id_btn_period_'+pre).attr("class", "button small02");
		$('#id_btn_period_'+period).attr("class", "button small02 on");
		$i.val(period);
		$('#id_startPeriod').val('');
		$('#id_endPeriod').val('');
	}
	,periodRange:function(){
		var $i = $('#id_speriod');
		$('#id_btn_period_'+$i.val()).attr("class", "button small02");
		$i.val(-1);
	}
}

 

